// 内容高度
$('body').width($(document).outerWidth(true));
$('body').height($(document).outerHeight(true));

//接口地址
var url = "http://59.188.232.32";

//	获取钱币类型
var BE_type = GetQueryString("BE_type");

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}
if (BE_type == null || BE_type == undefined || BE_type == "") {
    BE_type = sessionStorage.getItem("BE_type");
} else {
    sessionStorage.setItem("BE_type", BE_type);
}
// BTC-ETH
if (BE_type == "0") {
    $(".b0_e1").html("BTC");
} else {
    $(".b0_e1").html("ETH");
}

function isErr(res) {
	alert(res.msg);
	if(res.msg == "请传入有效的Token"){
		location.href="login.html";
	}
}

//点击其他地方关闭用户信息
$(document).on('click', function() {
    $('.user_wrapper').hide();
})

// 用户信息显示隐藏
$('.user_msg').on('click', function(e) {
    if ($('.user_wrapper').css('display') == 'none') $('.user_wrapper').show();
    else $('.user_wrapper').hide();
    //防止冒泡
    e.stopPropagation();
})

var playId=sessionStorage.getItem("playId");
if(playId == null || playId == undefined || playId == ""){
	
}else{
	$(".user_id").html("ID "+playId);
}

//防止冒泡
$(".user_wrapper").on('click', function(e) {
	e.stopPropagation();
})

$(document).scroll(function() {
    var scrollTop = document.documentElement.scrollTop;
    if (scrollTop >= 100) {
        $('.user_wrapper').hide(500);
        $('.navbar-toggle').addClass("collapsed");
        $('.navbar-toggle').attr("aria-expanded", false);
        $("#navBar").removeClass("in");
        $("#navBar").attr("aria-expanded", false);
    }
});

//	睁眼闭眼
$(".kk_img").on("click",function(){
	if($(this).attr("data") == "1"){
		$(this).attr("data","2").attr("src","img/by.png");
		$("#recipient-name1").attr("type","text");	
	}else{
		$(this).attr("data","1").attr("src","img/zy.png");
		$("#recipient-name1").attr("type","password");	
	}
})

//	登录状态
var logonToken=sessionStorage.getItem("logonToken");
if(logonToken == "" || logonToken == null || logonToken == undefined){
	$(".img-responsive").attr("src","./img/geren5@2x.png");
}else{
	$(".img-responsive").attr("src","img/head_img.jpg");
}

/*Pre Loader
----------------------------- */
$(window).load(function() {
	'use strict';
	$('.loading-icon').delay(100).fadeOut();
	$('#preloader').delay(100).fadeOut('slow');
});